<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  author: Jsonor
  date: 2018/3/20 15:52
  description: Country view
--%>
<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" %>
<html>
<head>
  <title>城市信息</title>

  <style>
    * {
      margin: auto;
      text-align: center;

    }
  </style>
</head>
<body>
<h1>城市信息</h1>
<div style="margin: 8px;">
  <form action="/searchCountry.action">
    Region : <input type="text" name="region">
    <input type="submit" value="搜索">

    <a href="/view/add.jsp" style="text-align: right">添加</a>
  </form>
</div>
<table border="1px solid black" style="align: center;font-size: 13px;">
  <tbody style="">
  <tr>
    <td>Count</td>
    <td>Code</td>
    <td>Name</td>
    <td>Region</td>
    <td>SurfaceArea</td>
    <td>IndepYear</td>
    <td>Population</td>
    <td>ListExpectancy</td>
    <td>GNP</td>
    <td>HeadOfState</td>
    <td>Capital</td>
    <td>Code2</td>
    <td>Function</td>
  </tr>

  <c:forEach var="item" items="${countries}" varStatus="vs">
    <tr>
      <td>${vs.count}</td>
      <td>${item.code}</td>
      <td>${item.name}</td>
      <td>${item.region}</td>
      <td>${item.surfaceArea}</td>
      <td>${item.indepYear}</td>
      <td>${item.population}</td>
      <td>${item.lifeExpectancy}</td>
      <td>${item.gnp}</td>
      <td>${item.headOfState}</td>
      <td>${item.capital}</td>
      <td>${item.code2}</td>
      <td>
        <a href="/singlefind.action?code=${item.code}">修改</a>
        |
        <a href="javascript:;" onclick="already('${item.code}')">删除</a>
      </td>
    </tr>
  </c:forEach>
  </tbody>
</table>
</body>

<script>
    function already(ev){
        if(confirm("确定要删除吗"))
        {
            location ="/delete.action?code="+ev;
        }
    }
</script>
</html>
